#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ini.h"
#include "register.h"
#include "common.h"
#include "handle.h"

int main() {

    register_section("cmd0", NULL, process_section0, NULL);
    
    Section1Data section1_data = { 0 };
    register_section("cmd1", &section1_data, NULL, process_section1);
    
    Section2Data section2_data = { 0 };
    register_section("cmd2", &section2_data, NULL, process_section2);
    
    parseIni();

    int ep = getEp(devName);
    // 调用每个section的处理函数
    for (int i = 0; i < section_count; i++) {
        if (sections[i].handler2 != NULL) {
            sections[i].handler2(&ep, &cxlBaseInfo);
        } else if (sections[i].handler3 != NULL) {
            sections[i].handler3(&ep, &cxlBaseInfo, sections[i].data);
        }
    }
    return 0;
}